import { $Http } from '@/config/service/http';

export enum Api {
  // 文件申请
  filePage = '/dmsfile/publicFileProcessOrder/page', // 分页查询
  fileRevoke = '/dmsfile/publicFileProcessOrder/revoke', // 撤回
  fileDelete = '/dmsfile/publicFileProcessOrder/delete/', // 删除
  fileClose = '/dmsfile/publicFileProcessOrder/closeFlow', // 关闭
  treeDataSubject = '/system/subject/listSimple', //查询机构树以及用户
  fileAuto = '/dmsfile/publicFileProcessOrder/autoProductFormInfo', // 自动生成表单
  fileByName = '/dmsfile/publicFileProcessOrder/findFileByName', // 查询已生效文件
  fileSave = '/dmsfile/publicFileProcessOrder/save', // 保存
  generateCode = '/system/sequence/rule/generateCode', // 生成编码
  fileGet = '/dmsfile/publicFileProcessOrder/get', // 详情
  fileAudit = '/dmsfile/publicFileProcessOrder/audit', // 审核
  fileCountersign = '/dmsfile/publicFileProcessOrder/countersign', // 会签
  fileInfo = '/dmsfile/resourceFileInfo/getOnlineEditConfig' // 在线编辑-批注
}

export const CODE_RULE = {
  WJBM_WJSQ: 'DMSF01' // 文件申请	文件编码
};
export const filePage = (params) => {
  return $Http.api(Api.filePage, params, 'post');
};

export const fileRevoke = (params) => {
  return $Http.api(Api.fileRevoke, params, 'post');
};

export const fileClose = (params) => {
  return $Http.api(Api.fileClose, params, 'post');
};

// export const fileDelete = (params) => {
//   return $Http.api(Api.fileDelete, params, 'post');
// };

export const treeDataSubject = (params: any) => {
  return $Http.api(Api.treeDataSubject, params, 'post');
};

export const fileAuto = () => {
  return $Http.api(Api.fileAuto, null, 'post');
};

export const fileByName = (params) => {
  return $Http.api(Api.fileByName, params, 'post');
};

export const fileSave = (params) => {
  return $Http.api(Api.fileSave, params, 'post');
};

export const generateCode = (params) => {
  return $Http.api(Api.generateCode, params, 'post');
};

export const fileGet = (id) => {
  return $Http.api(Api.fileGet + '/' + id, null, 'get');
};

export const fileAudit = (params) => {
  return $Http.api(Api.fileAudit, params, 'post');
};

export const fileCountersign = (params) => {
  return $Http.api(Api.fileCountersign, params, 'post');
};

export const fileInfo = (id) => {
  return $Http.api(Api.fileInfo + '/' + id, null, 'get');
};
